﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace WebSilverlightService
{
    // NOTE: If you change the class name "WSStats" here, you must also update the reference to "WSStats" in Web.config and in the associated .svc file.
    public class WSStats : IWSStats
    {
        /// <summary>
        /// Implements method GetYearStats of interface IWSStats.
        /// Populates object YearValues.
        /// </summary>
        /// <param name="subject"></param>
        /// <param name="requestedYear"></param>
        /// <returns></returns>

        public YearValues GetYearStats(string subject, int requestedYear)
        {
            return new YearValues()
            {
                year = requestedYear,
                monthlyData = Stats.ReadDailyStatsTableModule.getYearStats(subject, requestedYear),
                graphSubject = subject
            };
            
            
        }
        /// <summary>
        /// Implements method GetMonthStats of interface IWSStats.
        /// Populates object MonthValues
        /// </summary>
        /// <param name="subject"></param>
        /// <param name="requestedYear"></param>
        /// <param name="requestedMonth"></param>
        /// <returns></returns>
        public MonthValues GetMonthStats(string subject, int requestedYear, int requestedMonth)
        {
            return new MonthValues()
            {
                year = requestedYear,
                month = requestedMonth,
                daysData = Stats.ReadDailyStatsTableModule.getMonthStats(subject, requestedYear,requestedMonth),
                graphSubject = subject
            };


        }

    }
}
